from core.Interfaces import Interfaces

class Bot(object)
      def __init__(self, interfaces):
          self.interfaces = interfaces

      def configure(self):
          self.interfaces.blog.is_ready()
          self.interfaces.database.create()
          self.interfaces.repository.create()
          self.interfaces.website.is_ready()
          self.interfaces.schedule.declare('start')

      def start(self):
          self.interfaces.repository.start()
          self.interfaces.website.start()
          self.interfaces.blog.start()
          self.interfaces.database.start()
          self.interfaces.repository.evaluate(self.interfaces.database)
          self.interfaces.database.evaluate()
          self.interfaces.database.update_website(self.interfaces.website)
          self.interfaces.database.update_cloud(self.interfaces.cloud)
          self.interfaces.database.update_blog(self.interfaces.blog)
          self.interfaces.schedule.declare('update')
          self.interfaces.database.stop()
          self.interfaces.blog.stop()
          self.interfaces.website.stop()
          self.interfaces.repository.stop()

      def update(self):
          self.interfaces.blog.start()
          self.interfaces.cloud.start()
          self.interfaces.database.start()
          self.interfaces.repository.start()
          self.interfaces.website.start()
          self.interfaces.blog.download(self.interfaces.repository)
          self.interfaces.website.download(self.interfaces.repository)
          self.interfaces.cloud.download(self.interfaces.repository)
          self.interfaces.repository.evaluate(self.interfaces.database)
          self.interfaces.database.evaluate()
          self.interfaces.database.update_website(self.interfaces.website)
          self.interfaces.database.update_cloud(self.interfaces.cloud)
          self.interfaces.database.update_blog(self.interfaces.blog)
          self.interfaces.schedule.declare('update')
          self.interfaces.blog.stop()
          self.interfaces.cloud.stop()
          self.interfaces.database.stop()
          self.interfaces.repository.stop()
          self.interfaces.website.stop()


